package com.main.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.main.bean.User;
import com.main.dao.UserDao;

@Service("userService")
@Transactional
public class UserService {

	@Autowired
	private UserDao userDao;
	
	/**
	 * 获取用户
	 * @param user
	 * @return
	 */
	public User getUserByName(User user){
		return userDao.getUserByName(user);
	}
	
	/**
	 * 获取用户
	 * @param user
	 * @return
	 */
	public User getUserByEmail(User user){
		return userDao.getUserByEmail(user);
	}
	
	
	/**
	 * 查询是否存在用户
	 * @param user
	 * @return
	 */
	public int getUserCount(User user){
		return userDao.getUserCount(user);
	}
	/**
	 * 添加用户
	 * @param user
	 * @return
	 */
	public int addUser(User user){
		return userDao.add(user);
	}
}
